<template>
	<div>
		<el-button-group class="jc_btn_wrap jc_btn_left">
			<el-button @click="createRow"><i class="jc_icon el-icon-plus"></i>新建</el-button>
			<el-button @click="editRow"><i class=""></i>编辑</el-button>
			<el-button @click="deleteRow"><i class=""></i>删除</el-button>
		</el-button-group>
        <el-table :height="height-60" :data="paramlist"  border fit highlight-current-row class="jc_table_wrap"  @selection-change="handleSelectionChange">
			<el-table-column type="selection" width="80px"></el-table-column>
			<el-table-column label='工艺名称'>
				<template scope="scope"> {{scope.row.paramName}}  </template>
			</el-table-column>
			<el-table-column label='工艺参数'>
				<template scope="scope"> {{scope.row.param}}  </template>
			</el-table-column>
			<el-table-column label='备注'>
				<template scope="scope"> {{scope.row.remark}}  </template>
			</el-table-column>
			<el-table-column label='创建人'>
				<template scope="scope"> {{scope.row.userName}}  </template>
			</el-table-column>
			<el-table-column label='创建时间'>
				<template scope="scope"> {{scope.row.createTime}}  </template>
			</el-table-column>
        </el-table>
        <el-pagination
			@size-change="handleSizeChange"
			@current-change="changePage"
			:current-page="currentPage"
			:page-size="pageSize"
			layout="total, sizes, prev, pager, next, jumper"
			:total="total">
        </el-pagination>
        <!--新建-->
        <el-dialog title="新建工艺参数" :visible.sync="createVisible" class="jc_dialog_wrap">
	        <el-form :model="form_create" label-width="120px">
				<el-form-item label="工艺名称">
					<el-input v-model="form_create.pathNo"></el-input>
				</el-form-item>
				<el-form-item label="工艺参数">
					<el-input v-model="form_create.pathName"></el-input>
				</el-form-item>
				<el-form-item label="备注">
					<el-input v-model="form_create.remark"></el-input>
				</el-form-item>
	        </el-form>
	        <div slot="footer" class="dialog-footer">
				<el-button type="primary" @click="submitCreateForm">确定</el-button>
				<el-button @click="create_visible=false">取消</el-button>
	        </div>
        </el-dialog>
        <!--编辑-->
		<el-dialog title="编辑工艺参数" :visible.sync="editVisible" class="jc_dialog_wrap">
			<el-form :model="form_edit" label-width="120px">
				<el-form-item label="工艺名称">
					<el-input v-model="form_edit.pathNo"></el-input>
				</el-form-item>
				<el-form-item label="工艺参数">
					<el-input v-model="form_edit.pathName"></el-input>
				</el-form-item>
				<el-form-item label="备注">
					<el-input v-model="form_edit.remark"></el-input>
				</el-form-item>
			</el-form>
		<div slot="footer" class="dialog-footer">
			<el-button type="primary" @click="submitEditForm">确定</el-button>
			<el-button @click="edit_visible=false">取消</el-button>
		</div>
		</el-dialog>
	</div>
</template>
<script>
  import * as Pramscontroller from "@/api/process/pramscontroller"; 
	export default{
		props:{
           paramlist:Array,
           height:Number,
           total:Number,
           pathId:Number,
           createVisible:Boolean,
           editVisible:Boolean
		},
         data (){
            return {
                list:[],
                inputList:[],
                currentPage:1,
                pageSize:10,       
                form_edit:{},
                form_create:{},
                multipleSelection:[]  
            }
         },
         created() {
         	console.log(' createVisible',)
         },
         methods:{
         	createRow(){
         		console.log('我的ID',this.pathId)
         		if(this.pathId){
         			this.createVisible = true;
                    this.form_create = {};  
         		}else{
         			this.$message({
			            type:'warning',
			            message:'请选择工序信息'
			          }) 
         		}
                
         	},
         	submitCreateForm(){
         		console.log(this.form_create)
                 // this.$emit('submitCreateProcessParam',this.form_create)
         	},
         	editRow(){
                 if(this.multipleSelection.length === 0) {
			          this.$message({
			            type:'warning',
			            message:'请先勾选行'
			          }) 
			        }else if(this.multipleSelection.length >= 2) {
			           this.$message({
			            type:'warning',
			            message:'每次最多勾选一行'
			          }) 
			        }else if(this.multipleSelection.length === 1) {
			          // MaterialType.getList({typeName:this.multipleSelection[0].typeName}).then(data => {
			          //   this.edit_visible = true;
			          //   this.form_edit.id = data.rows[0].id;
			          //   this.form_edit.typeName = data.rows[0].typeName;
			          //   this.form_edit.remark = data.rows[0].remark;
			          // })
			        }
         	},
         	submitEditForm(){
			    this.$emit('processParamEdit')
                 
         	},
         	deleteRow(){

         	},
         	handleSelectionChange(val){
                this.multipleSelection = val;
         	},
         	handleSizeChange(){

         	},
         	changePage(){

         	},
         	rowsClick(){

         	}

         }
	}
</script>
<style scoped> 
	
</style>